/*
 * Copyright 2020 tu.cn All right reserved. This software is the
 * confidential and proprietary information of tu.cn ("Confidential
 * Information"). You shall not disclose such Confidential Information and shall
 * use it only in accordance with the terms of the license agreement you entered
 * into with Tu.cn
 */
package com.onedec.utils;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @author 31014
 * @date 2020/7/9 13:11
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResponseEntity<T> {
    private String code;
    private String msg;
    private T data;
    //没有携带数据的成功常量
    public static final ResponseEntity<Void> SUCCESS=new ResponseEntity<>("200","success",null);
    //没有携带数据的异常常量
    public static final ResponseEntity<Void> ERROR=new ResponseEntity<>("500","ERROR",null);
    /**
     * 成功的构造函数
     * @param data 成功返回值
     */
    public ResponseEntity(T data) {
        this("200", "success", data);
    }
    /**
     * 只返回信息与响应码的响应
     * @param msg 信息
     * @param code 响应码
     */
    public ResponseEntity(String msg, String code) {
        this(code, msg, null);
    }


}